package com.ncomz.cspace.common.session;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;


/**
 * 클래스설명 : 
 * @version : 2013. 8. 23.
 * @author : 이석균
 * @분류 : 
 * cSpace / package com.ncomz.cspace.common.session;
 */
public class CommonSession extends HandlerInterceptorAdapter{
	
	private static final Logger log = LoggerFactory.getLogger(CommonSession.class);
	
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response) throws Exception { 
		
		log.info("session체크");
		HttpSession session  =  request.getSession();
		
		String member_id = (String)session.getAttribute("id");
		
		log.info("현재 로그인하려는 member_id = "+member_id);
		if ( member_id == null) {		//session check
			response.sendRedirect("loginpage.do");
			return false;
		}

		else{
			return true;
		}
		
	}

	
}